The present invention relates to enabling multiple client requesters running within the scope of a single process (such as a single Java Virtual Machine) to be distinguished from each other when accessing a system or computer program which relies on process identifiers. The invention is particularly applicable when providing Java client support for a process-based legacy system or program.
In certain distributed client/server data processing environments, many client processes such as application programs can request services provided by one or more servers (e.g. a transactional resource manager program, or any other process having a server/client relationship to the requester processes) and the source of the request is determined at the server by two pieces of information: the system identifier of the machine the client process is running on and a process identifier of the client process. This method of recognising requests has proven effective in the past, because each individual application program and each executable piece of code running on a data processing system is allocated a system-unique process identifier which can be sent to the server.
It is known in the art to provide system architectures and communication protocols which always maintain a direct connection between a client requester process and a server process, and for server processes to identify the individual requester by means of this connection (such as if both the client requester process and the server process support TCP/IP socket connections and the server process can identify individual client requesters using the TCP/IP socket connection). However, as noted above, some server processes (including some legacy programs architected before TPC/IP communication was so widely used) use a process identifier to identify the origin of a request. This latter method of recognising requests is suitable for traditional client applications which are compiled into an executable form and each run in their own process.
However, applications written in the Java programming language may be running in, or may communicate with a Servlet running in, a Java Virtual Machine under the same process identifier. Therefore, it is possible for requests from two or more clients which are sent via the same Java Virtual Machine to have the same system identifier and process identifier such that a server which receives the requests is unable to distinguish them as originating from different client applications. This leads to problems routing replies and potential resource access conflicts. For instance, two clients running within a single process (Java Virtual Machine) may make requests to obtain rows from a shared data source. If the data source provider uses a combination of system identifier and process identifier (or uses only a network-unique process identifier) to allocate a shared lock on the data source, then the two clients will be indistinguishable to the data source, and requests from both will be treated as requests originating from a single client. If client A begins to iterate through the rows of the data source then it will retrieve each row in turn, and in order starting from the first row. If client B, running within the same process then starts to iterate through the data source, the data source will recognise an iteration request from the same, indistinguishable, client and provide the next row which should have been provided to client A. (Java is a trademark of Sun Microsystems Inc.)
This problem could arise for any server process, program or system which fulfils a server role within a data processing network and which differentiates between client processes by means of a process identifier, if it is possible for multiple client requesters to appear to have the same process identifier.
In a first aspect, the present invention provides a method for managing communications between requester processes and server processes in a data processing network, including: creating a set of dispatcher processes, each having a unique process identifier; associating each of a set of requester processes, which communicate with a server process via a common interpreter process, with a different dispatcher process of said set of dispatcher processes; for requests sent from any of said set of requester processes via said common interpreter process to a server process which identifies requester processes using a process identifier, routing said requests via the associated dispatcher process; at the respective dispatcher process, attaching the unique identifier of the dispatcher process to the request and then forwarding the request to the server process; and responsive to receipt by the dispatcher process of a reply to said request, forwarding the reply to the associated requester process.
The invention addresses the problem of differentiating between processes which appear to a server process to have the same process ID associated with them, for example processes which run within a common process such as a single Java Virtual Machine (JVM), such that a server process which relies on the process ID to differentiate between sender client processes cannot determine the source of a request. This problem can lead to routing problems and conflicts between requests which are sent by different client processes running under the same process ID, particularly if the client processes are running concurrently.
The invention is particularly advantageous for providing Java client support for a legacy computer program, where multiple concurrent client access is desired. This is of particular benefit when the Java support is required to enable the legacy program to interoperate with a Web application server which has multiple Servlet threads running within its JVM to service multiple concurrent clients (Web Browsers). The present invention can then be used to enable Web-based access to the legacy program from client systems and devices which do not have the legacy program installed.
A further advantage of the invention is that it is implementable without completely rewriting an existing legacy architecture.
According to a second aspect, the invention provides a computer program, preferably implemented as a program product comprising program code recorded on a machine readable recording medium, the program code including instructions for controlling the operation of an apparatus to implement a method as described above.
According to a third aspect, the invention provides a data processing apparatus comprising means for implementing a method as described above, as set out in the accompanying claims.